<template>
  <div>
    <headerNav />
    <div class="mindWidth container">
      <div class="nav">
        <span @click="$router.push('/')">首页</span> >
        <span @click="$router.push('/achievList')">成果转化</span> >
        <span>详情</span>
      </div>
      <div class="content">
        <div class="name">{{detailInfo.achievementsName}}</div>
        <div class="content-box flex items-middle">
          <div class="img-content">
            <el-carousel v-if="detailInfo.achievementsImages">
              <el-carousel-item
                class="carousel-item"
                v-for="(item, index) in detailInfo.achievementsImages"
                :key="index"
              >
                <img :src="imgBaseUrl + item" class="carousel-img" />
              </el-carousel-item>
            </el-carousel>
          </div>
          <div class="information">
            <div>
              <span>成果来源：</span>
              {{detailInfo.achievementsSource}}
            </div>
            <div>
              <span>联 系 人：</span>
              {{detailInfo.achievementsContacts}}
            </div>
            <div>
              <span>联系电话：</span>
              {{detailInfo.achievementsPhoneNumber}}
            </div>
          </div>
        </div>
        <div class="content-info">{{detailInfo.achievementsContent}}</div>
      </div>
    </div>
    <navigation />
    <footerNav />
  </div>
</template>
<script>
import { achievementsDetail, imgBaseUrl } from "../../api/api.js";
export default {
  data() {
    return {
      imgBaseUrl: imgBaseUrl,
      id: this.$route.params.id,
      detailInfo: {}
    };
  },
  head() {
    return {
      title: `${this.detailInfo.achievementsName}-比目镜`,
      meta: [
        {
          hid: "keywords",
          name: "keywords",
          content: this.detailInfo.achievementsName
        },
        {
          hid: "description",
          name: "description",
          content: this.detailInfo.achievementsName
        }
      ]
    };
  },
  async asyncData({ app, route, err }) {
    let id = route.params.id;
    let { result } = await achievementsDetail({ id: id });
    // console.log(5555555, result);
    return {
      detailInfo: result
    };
  },
  mounted() {
    // this.getDetail();
  },
  methods: {
    // getDetail() {
    //   achievementsDetail({ id: this.id }).then(res => {
    //     this.detailInfo = res.result;
    //   });
    // }
  }
};
</script>
<style lang="less" scoped>
.container {
  .nav {
    width: 100%;
    height: 50px;
    line-height: 50px;
    span {
      font-size: 14px;
      color: #333;
      margin: 0 10px;
      cursor: pointer;
    }
  }
  .content {
    .name {
      font-size: 18px;
      font-weight: 600;
      padding: 20px 0;
    }
    .content-box {
      margin-bottom: 20px;
      .img-content {
        width: 600px;
        height: 300px;
        margin-right: 20px;
        .carousel-item {
          width: 100%;
          height: 100%;
          background: white;
          display: flex;
          justify-content: center;
        }
        .carousel-img {
          max-width: 100%;
          max-height: 100%;
        }
      }
      .information {
        span {
          font-size: 16px;
          color: #aaa;
        }
        div {
          margin-bottom: 15px;
          font-size: 18px;
          font-weight: 600;
        }
      }
    }
    .content-info {
      min-height: 180px;
      width: 75%;
      text-indent: 32px;
      line-height: 25px;
    }
  }
}
</style>
